$(function(){
		$( ".nav" ).tabs({
			event: "click",
			ajaxOptions: {
				error: function( xhr, status, index, anchor ) {
					$( anchor.hash ).html(
						"Couldn't load this tab. We'll try to fix this as soon as possible."								 					);
				},
				success:function(xhr){
					$("#ui-tabs-2").html("");
					$("#ui-tabs-1").html("");
					$("#ui-tabs-3").html("");
					$("#ui-tabs-4").html("");
					$("#centerright").html(xhr);
				}
			}
		});
		
		$("a").click(function(){
			$("a").children("img").hide();
			$(this).children("img").show();
		});
		
	    /*查看、关闭*/
		var show_png = "images/show.png";
		var close_png = "images/close.png";
		
		$(".show").bind("click",function(){
			var src_orgin = $(this).attr("src");
			if(src_orgin == show_png){
				$(this).attr("src",close_png);
				$(this).parents(".ancestor_img").next(".describe").removeClass("hidden");
			}else if(src_orgin == close_png){
				$(this).attr("src",show_png);
				$(this).parents(".ancestor_img").next(".describe").addClass("hidden");
			}
		});		
		
		/*菜单*/
		$("img.menu").bind("click",function(){
			beforHandler();
			afterHandler(this);
		});		
		/*预先处理 */
		function beforHandler(){
			$("img.menu").removeClass("hidden");
			$("img.menu_brother").addClass("hidden");
			$("div.items").addClass("hidden");
		}
		/* 后处理 */
		function afterHandler(obj){
			$(obj).addClass("hidden");
			$(obj).next("img").removeClass("hidden");
			var content_id = getDivElementId(obj);
			$(content_id).removeClass("hidden");
		}
		/*获取相对此obj对象所对应要显示的div的id,并加上了前缀 #*/
		function getDivElementId(obj){
			var element_id = $(obj).attr("id");
			var lastIndex = element_id.lastIndexOf("_");
			var sub_str = element_id.substr(lastIndex+1,element_id.length);
			return "#"+sub_str;
		}
	});